<div class="page-wrapper d-flex flex-column pt-4">
    <div class="container-xl">
        <div class="page-header d-print-none">
            <div class="row align-items-center">
                <div class="col">
                    <div class="page-pretitle">
                        Listing
                    </div>
                    <h3 class="page-title">
                        All Pages
                    </h3>
                </div>
            </div>
        </div>
    </div>
    <div class="page-body d-flex flex-row-reverse">
        <aside class="bd-sidebar sub-sidebar">
            <nav class="bd-links p-3" aria-label="Sub-section navigation">
                <div class="card card-body">
                    <filter-list class="" request="request" callback="getList(pageIndex)"
                        create-url="'/portal/page/create'" create-text="'Create Page'"></filter-list>
                </div>
            </nav>
        </aside>

        <!-- ----------------------------------------------------------- -->

        <div class="content-body py-3 pe-3">

            <div class="card  mb-5">
                <div class="card-body">

                    <table id="list-page" class="table table-striped-x table-hover" dnd-list="data.items"
                        dnd-disable-if="canDrag" cellspacing="0" ng-init="getList()">
                        <thead class="thead-light">
                            <tr>
                                <th scope="col" width="15px">
                                    <div class="form-check m-0 p-0">
                                        <input type="checkbox" class="form-check-inputx"
                                            ng-model="selectedList.isSelectAll"
                                            ng-change="selectAll(selectedList.isSelectAll)" id="customCheck_all" />
                                    </div>
                                </th>
                                <th class="col">Page</th>
                                <th class="col">Thumb</th>
                                <th class="col">Feature</th>
                                <th class="col">Created</th>
                                <th class="col">Author</th>
                                <th class="col">

                                </th>
                                <th class="col text-end"></th>
                            </tr>
                        </thead>

                        <tbody class="">
                            <tr ng-repeat="item in data.items" dnd-draggable="item" dnd-effect-allowed="move"
                                dnd-selected="selected = item" dnd-moved="updateInfos($index)"
                                ng-class="{'selected': selected === item}" class="" sort-model="category"
                                sort-model-id="{{item.id}}">
                                <td class="align-middle">
                                    <div class="form-check">
                                        <input type="checkbox" class="form-check-input" id="customCheck_{{item.id}}"
                                            ng-model="item.isSelected" ng-change="select(item.id, item.isSelected)" />
                                        <label class="custom-control-label" for="customCheck_{{item.id}}"></label>
                                    </div>
                                </td>
                                <td class="">
                                    <a href="" ng-click="goToPath('/portal/page/details/' + item.id)" class="btn-link"
                                        title="{{item.excerpt}}">
                                        <small ng-if="item.type == 'Home'"><i
                                                class="fas fa-home text-danger"></i></small>
                                        <small ng-if="item.type == 'ListPost'"><i class="far fa-list-alt"></i></small>
                                        <small ng-if="item.type == 'Article'"><i class="fas fa-book"></i></small>
                                        <small ng-if="item.type == 'System'"><i class="fas fa-cogs"></i></small>
                                        {{item.title}}
                                    </a>
                                </td>
                                <td>
                                    <preview-image img-height="25" img-src="item.thumbnailUrl"></preview-image>
                                </td>
                                <td>
                                    <preview-image img-height="25" img-src="item.imageUrl"></preview-image>
                                </td>
                                <td class="text-secondary">
                                    <small>
                                        {{item.createdDateTime | utcToLocal:'dd.MM.yy hh:mm a'}}
                                    </small>
                                </td>
                                <td class="text-secondary">
                                    <small>{{item.createdBy}}</small>
                                </td>
                                <td class="text-black-50">
                                    <small ng-if="item.status == 'Published'">🟢</small>
                                    <small ng-if="item.status == 'Schedule'">🟡</small>
                                    <small ng-if="item.status == 'Draft'">🔴</small>
                                    <small ng-if="item.status == 'Deleted'">⚫️</small>
                                </td>
                                <td>
                                    <div class="dropdown float-lg-end ms-auto pe-1">
                                        <a href="javascript:;" class="cursor-pointer" id="dropdownTable2"
                                            data-bs-toggle="dropdown" aria-expanded="false">
                                            <i class="fa fa-ellipsis-h text-secondary" aria-hidden="true"></i>
                                        </a>
                                        <ul class="dropdown-menu px-2 py-3 ms-sm-n4 ms-n5"
                                            aria-labelledby="dropdownTable2" style="">
                                            <li><a href="" ng-click="goToPath('/portal/page/details/' + item.id)"
                                                    class="dropdown-item border-radius-md">
                                                    <span class="fas fa-pen"></span> Edit
                                                </a>
                                            </li>
                                            <li><a href="{{item.detailsUrl}}" target="_blank"
                                                    class="dropdown-item border-radius-md">
                                                    <span class="fas fa-eye"></span> Preview
                                                </a>
                                            </li>
                                            <li>
                                                <a href="" ng-if="item.type=='ListPost'"
                                                    ng-click="goToPath('/portal/page/page-post/list/' + item.id)"
                                                    class="dropdown-item border-radius-md">
                                                    <span class="fas fa-bars"></span> Child posts
                                                </a>
                                            </li>
                                            <li><a href="" class="dropdown-item border-radius-md"
                                                    ng-click="duplicate(item.id)">
                                                    <span class="fas fa-copy"></span> Copy page
                                                </a></li>
                                            <li><a href="" ng-click="remove(item.id);"
                                                    class="dropdown-item border-radius-md text-danger">
                                                    <i class="fas fa-trash-alt"></i> Delete
                                                </a></li>
                                        </ul>
                                    </div>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </div>
                <div class="card-body">
                    <paging class="small" page="data.page" page-size="data.pageSize" total="data.totalItems"
                        ul-class="pagination justify-content-end m-0" a-class="page-link"
                        paging-action="getList(page-1)" scroll-top="true">
                    </paging>
                </div>
            </div>
        </div>
    </div>
</div>